package configuration 
{
	
	import flash.display.Bitmap;
	import flash.utils.Dictionary;
	import starling.textures.Texture;
	import starling.textures.TextureAtlas;
	import starling.events.TouchEvent;
	/**
	 * ...
	 * @author ania
	 */
	public class SourceTextures 
	{
		
		//mes texture ici !
	/*	[Embed(source = "../Assets/textures/BG.jpg")]
		private static const BG_TEX:Class
				
		//les textures animé (textureAtlas)-(movies)
		[Embed(source="../Assets/textureAnim/iconSeq.png")]
		private static const ICONSEQ_TEX:Class;
		
		//sont toujours suivi d'un XML
		[Embed(source="../Assets/textureAnim/iconSeq.xml", mimeType="application/octet-stream")]
		private static const ICONSEQ_XML:Class;
	*/	
		// dictionnaire qui contiendra toutes mes textures.
		private static var imageTextures: Dictionary = new Dictionary();
		private static var movieTextures:Dictionary = new Dictionary();
		
		
		
		//permet la récuperatio des textures.
		public static function getTexture(name :String) : Texture 
		{
			
			if(imageTextures[name]== undefined) // si elle n'existe pas
			{
				var bitmap:Bitmap = new SourceImage[name];
				imageTextures[name]=Texture.fromBitmap(bitmap); // on la renseigne dans notre dictionnaire
			}
			return imageTextures[name] // renvoie de notre texture
			
		}
		
		
		//permet la récupération des textures animés.
		public static function getMovieTexture(name:String):TextureAtlas
		{
			if(movieTextures[name]== undefined)
			{
				
				var _tex:Texture=Texture.fromBitmap(new SourceImage[name+"_TEX"]())
				var _xml:XML=XML(new SourceImage[name+"_XML"]())
				var _atlas:TextureAtlas= new TextureAtlas(_tex,_xml)
				
				movieTextures[name]=_atlas // on la renseigne dans notre dictionnaire
			}
			return movieTextures[name] // renvoie de notre MovieClip
		}
		
	}

}

		
	

	
		